//
//  CCDiscoverTableViewCell.m
//  CwinCar
//
//  Created by dlios on 15/10/15.
//  Copyright © 2015年 dlios. All rights reserved.
//

#import "CCDiscoverTableViewCell.h"
#import "LowPriceCollectionCell.h"
#import "BaseHeader.h"
@implementation CCDiscoverTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
#pragma mark tableView自定义Cell里创建collectionView
        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
        flowLayout.itemSize = CGSizeMake(mainScreen_Width / 4.687, mainScree_Height / 11.116);
        flowLayout.minimumInteritemSpacing = 5.;
        flowLayout.sectionInset = UIEdgeInsetsMake(5, 5, 5, mainScree_Height / 16.675);
        [flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
        _collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, mainScreen_Width, mainScree_Height / 9.528) collectionViewLayout:flowLayout];
        [_collectionView setBackgroundColor:[UIColor whiteColor]];
        [self.contentView addSubview:_collectionView];
        
        [_collectionView registerClass:[LowPriceCollectionCell class] forCellWithReuseIdentifier:@"LjjLowPriceCollectionViewCell"];
    }
    return self;
}

-(void)setDelegate:(id<UICollectionViewDelegate>)delegate
{
    [_collectionView setDelegate:delegate];
}
-(void)setDataSource:(id<UICollectionViewDataSource>)dataSource
{
    [_collectionView setDataSource:dataSource];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
